package com.kerrykidz.system.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.kerrykidz.membership.dao.mapper.GblCusCpndefEntityMapper;
import com.kerrykidz.membership.dao.model.GblCusCpndefEntity;
import com.kerrykidz.system.service.ICusCpndefService;
import com.rdp.framework.exception.RDPException;

@Service
public class CusCpndefServiceImpl implements ICusCpndefService {

	@Autowired
	private GblCusCpndefEntityMapper gblCusCpndefEntityMapper;
	
	/**
	 * 优惠劵分页显示
	 * @param gblCusCpndef
	 * @return
	 * @throws RDPException
	 */
	@Override
	public GblCusCpndefEntity findGblCusCpndef(GblCusCpndefEntity gblCusCpndef) throws RDPException {
		gblCusCpndef.setIspaging(true);
		List<GblCusCpndefEntity> gccBeans = gblCusCpndefEntityMapper.findGblCusCpndef();
		if(gccBeans.size() > 0)
		{
			gblCusCpndef.setResults(gccBeans);
		}
		return gblCusCpndef;
	}

	/**
	 * 添加新的优惠劵
	 * @param gblCusCpndef
	 * @throws RDPException
	 */
	@Override
	public void insertGblCusCpndef(GblCusCpndefEntity gblCusCpndef)
			throws RDPException {
		gblCusCpndefEntityMapper.insertGblCusCpndef(gblCusCpndef);
	}

	/**
	 * 更新优惠劵
	 * @param gblCusCpndef
	 * @throws RDPException
	 */
	@Override
	public void updateGblCusCpndef(GblCusCpndefEntity gblCusCpndef)
			throws RDPException {
		gblCusCpndefEntityMapper.updateGblCusCpndef(gblCusCpndef);
	}
}
